import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';

part 'create_property_model.g.dart';

// PropertyNameModel 属性名称模型
@JsonSerializable(explicitToJson: true)
class CreatePropNameModel extends Equatable {
  final String name;
  final String language;

  CreatePropNameModel({this.name, this.language});
  
  factory CreatePropNameModel.fromJson(Map<String, dynamic> json) =>
      _$CreatePropNameModelFromJson(json);
  Map<String, dynamic> toJson() => _$CreatePropNameModelToJson(this);
  @override
  List<Object> get props => [name, language];
}

// 属性选项模型
@JsonSerializable(explicitToJson: true)
// ignore: must_be_immutable
class CreateOptionModel extends Equatable {
  final String optionId;
  final bool allowEdit;
  final List<CreateOptionNameModel> attributeOptioneNames;
  var addPrice;
  final String groupType;
  final int orderValue;
  final String optionName;

  CreateOptionModel({
    this.optionId,
    this.allowEdit,
    this.attributeOptioneNames,
    this.addPrice,
    this.groupType = 'attr',
    this.orderValue = 0,
    this.optionName
  });

  factory CreateOptionModel.fromJson(Map<String, dynamic> json) =>
      _$CreateOptionModelFromJson(json);
  Map<String, dynamic> toJson() => _$CreateOptionModelToJson(this);
  @override
  List<Object> get props => [optionId, allowEdit, attributeOptioneNames, addPrice, groupType, orderValue];
}

// OptionNameModel 属性选项名称模型
@JsonSerializable(explicitToJson: true)
class CreateOptionNameModel extends Equatable {
  final String name;
  final String language;

  CreateOptionNameModel({this.name, this.language});

  factory CreateOptionNameModel.fromJson(Map<String, dynamic> json) =>
      _$CreateOptionNameModelFromJson(json);
  Map<String, dynamic> toJson() => _$CreateOptionNameModelToJson(this);
  @override
  List<Object> get props => [name, language];
}



